<h1>Listing phones</h1>

<table>
  <tr style="font-weight:bold;">
	<td>Name</td>
	<td>Number</td>
	<td>Last ping</td>
	<td>Created</td>
  </tr>

<% for phone in @phones %>
  <tr>
	<td><%= phone.name %></td>
	<td><%= phone.number %></td>
	<td><% unless phone.last_ping.nil? %>
			<%= phone.last_ping.street_number %> 
			<%= phone.last_ping.thoroughfare %>, 
			<%= phone.last_ping.locality %> 
			<%= phone.last_ping.state %>
		<% end %>
	</td>
	<td><%= phone.created_at.to_s(:short) %></td>
    <td><%= link_to 'Edit', edit_phone_path(phone) %></td>
    <td><%# link_to 'Destroy', phone, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%# link_to 'New message', new_phone_path %>
